package com.csweimei.rentmanagementtreasure.pop;

import android.content.Context;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.csweimei.rentmanagementtreasure.R;
import com.lxj.xpopup.core.BottomPopupView;

public class PopBuy extends BottomPopupView {



    LinearLayout llZfb,llWx;
    ImageView ivZfb,ivWx;
    TextView sure;

    String payType = "2";
    PopSelClick mPopSelClick;

    public PopBuy(@NonNull Context context,PopSelClick popSelClick) {
        super(context);
        mPopSelClick = popSelClick;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        llZfb = findViewById(R.id.ll_zfb);
        llWx = findViewById(R.id.ll_wx);
        ivZfb = findViewById(R.id.iv_zfb);
        ivWx = findViewById(R.id.iv_wx);
        sure = findViewById(R.id.sure);

        llZfb.setOnClickListener(v -> {
            ivZfb.setImageResource(R.mipmap.pay_sel);
            ivWx.setImageResource(R.mipmap.pay_un);
            payType ="2";
        });

        llWx.setOnClickListener(v -> {
            ivWx.setImageResource(R.mipmap.pay_sel);
            ivZfb.setImageResource(R.mipmap.pay_un);
            payType ="1";
        });

        sure.setOnClickListener(v -> {
            mPopSelClick.sel(new PopBean(payType));
            dismiss();
        });

    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.pop_buy;
    }
}
